3.6.60 \(\int (a+b \cos (c+d x))^2 (a^2-b^2 \cos ^2(c+d x)) \, dx\) [560]

3.6.60.1 Optimal result
3.6.60.2 Mathematica [A] (verified)
3.6.60.3 Rubi [A] (verified)
3.6.60.4 Maple [A] (verified)
3.6.60.5 Fricas [A] (verification not implemented)
3.6.60.6 Sympy [A] (verification not implemented)
3.6.60.7 Maxima [A] (verification not implemented)
3.6.60.8 Giac [A] (verification not implemented)
3.6.60.9 Mupad [B] (verification not implemented)

3.6.60.1 Optimal result

Integrand size = 30, antiderivative size = 129 \[ \int (a+b \cos (c+d x))^2 \left (a^2-b^2 \cos ^2(c+d x)\right ) \, dx=\frac {1}{8} \left (8 a^4-3 b^4\right ) x+\frac {a b \left (13 a^2-8 b^2\right ) \sin (c+d x)}{6 d}+\frac {b^2 \left (14 a^2-9 b^2\right ) \cos (c+d x) \sin (c+d x)}{24 d}+\frac {a b (a+b \cos (c+d x))^2 \sin (c+d x)}{12 d}-\frac {b (a+b \cos (c+d x))^3 \sin (c+d x)}{4 d} \]

output
1/8*(8*a^4-3*b^4)*x+1/6*a*b*(13*a^2-8*b^2)*sin(d*x+c)/d+1/24*b^2*(14*a^2-9 
*b^2)*cos(d*x+c)*sin(d*x+c)/d+1/12*a*b*(a+b*cos(d*x+c))^2*sin(d*x+c)/d-1/4 
*b*(a+b*cos(d*x+c))^3*sin(d*x+c)/d
 
3.6.60.2 Mathematica [A] (verified)

Time = 0.35 (sec) , antiderivative size = 89, normalized size of antiderivative = 0.69 \[ \int (a+b \cos (c+d x))^2 \left (a^2-b^2 \cos ^2(c+d x)\right ) \, dx=-\frac {36 b^4 c-96 a^4 d x+36 b^4 d x-48 a b \left (4 a^2-3 b^2\right ) \sin (c+d x)+24 b^4 \sin (2 (c+d x))+16 a b^3 \sin (3 (c+d x))+3 b^4 \sin (4 (c+d x))}{96 d} \]

input
Integrate[(a + b*Cos[c + d*x])^2*(a^2 - b^2*Cos[c + d*x]^2),x]
 
output
-1/96*(36*b^4*c - 96*a^4*d*x + 36*b^4*d*x - 48*a*b*(4*a^2 - 3*b^2)*Sin[c + 
 d*x] + 24*b^4*Sin[2*(c + d*x)] + 16*a*b^3*Sin[3*(c + d*x)] + 3*b^4*Sin[4* 
(c + d*x)])/d
 
3.6.60.3 Rubi [A] (verified)

Time = 0.58 (sec) , antiderivative size = 137, normalized size of antiderivative = 1.06, number of steps used = 9, number of rules used = 9, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.300, Rules used = {3042, 3495, 25, 3042, 3232, 3042, 3232, 3042, 3213}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int (a+b \cos (c+d x))^2 \left (a^2-b^2 \cos ^2(c+d x)\right ) \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \left (a+b \sin \left (c+d x+\frac {\pi }{2}\right )\right )^2 \left (a^2-b^2 \sin \left (c+d x+\frac {\pi }{2}\right )^2\right )dx\)

\(\Big \downarrow \) 3495

\(\displaystyle -\int -\left ((a-b \cos (c+d x)) (a+b \cos (c+d x))^3\right )dx\)

\(\Big \downarrow \) 25

\(\displaystyle \int (a-b \cos (c+d x)) (a+b \cos (c+d x))^3dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \left (a-b \sin \left (c+d x+\frac {\pi }{2}\right )\right ) \left (a+b \sin \left (c+d x+\frac {\pi }{2}\right )\right )^3dx\)

\(\Big \downarrow \) 3232

\(\displaystyle \frac {1}{4} \int (a+b \cos (c+d x))^2 \left (4 a^2+b \cos (c+d x) a-3 b^2\right )dx-\frac {b \sin (c+d x) (a+b \cos (c+d x))^3}{4 d}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {1}{4} \int \left (a+b \sin \left (c+d x+\frac {\pi }{2}\right )\right )^2 \left (4 a^2+b \sin \left (c+d x+\frac {\pi }{2}\right ) a-3 b^2\right )dx-\frac {b \sin (c+d x) (a+b \cos (c+d x))^3}{4 d}\)

\(\Big \downarrow \) 3232

\(\displaystyle \frac {1}{4} \left (\frac {1}{3} \int (a+b \cos (c+d x)) \left (a \left (12 a^2-7 b^2\right )+b \left (14 a^2-9 b^2\right ) \cos (c+d x)\right )dx+\frac {a b \sin (c+d x) (a+b \cos (c+d x))^2}{3 d}\right )-\frac {b \sin (c+d x) (a+b \cos (c+d x))^3}{4 d}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {1}{4} \left (\frac {1}{3} \int \left (a+b \sin \left (c+d x+\frac {\pi }{2}\right )\right ) \left (a \left (12 a^2-7 b^2\right )+b \left (14 a^2-9 b^2\right ) \sin \left (c+d x+\frac {\pi }{2}\right )\right )dx+\frac {a b \sin (c+d x) (a+b \cos (c+d x))^2}{3 d}\right )-\frac {b \sin (c+d x) (a+b \cos (c+d x))^3}{4 d}\)

\(\Big \downarrow \) 3213

\(\displaystyle \frac {1}{4} \left (\frac {1}{3} \left (\frac {3}{2} x \left (8 a^4-3 b^4\right )+\frac {2 a b \left (13 a^2-8 b^2\right ) \sin (c+d x)}{d}+\frac {b^2 \left (14 a^2-9 b^2\right ) \sin (c+d x) \cos (c+d x)}{2 d}\right )+\frac {a b \sin (c+d x) (a+b \cos (c+d x))^2}{3 d}\right )-\frac {b \sin (c+d x) (a+b \cos (c+d x))^3}{4 d}\)

input
Int[(a + b*Cos[c + d*x])^2*(a^2 - b^2*Cos[c + d*x]^2),x]
 
output
-1/4*(b*(a + b*Cos[c + d*x])^3*Sin[c + d*x])/d + ((a*b*(a + b*Cos[c + d*x] 
)^2*Sin[c + d*x])/(3*d) + ((3*(8*a^4 - 3*b^4)*x)/2 + (2*a*b*(13*a^2 - 8*b^ 
2)*Sin[c + d*x])/d + (b^2*(14*a^2 - 9*b^2)*Cos[c + d*x]*Sin[c + d*x])/(2*d 
))/3)/4
 

3.6.60.3.1 Defintions of rubi rules used

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], x]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3213
Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*sin[(e_.) + (f_.) 
*(x_)]), x_Symbol] :> Simp[(2*a*c + b*d)*(x/2), x] + (-Simp[(b*c + a*d)*(Co 
s[e + f*x]/f), x] - Simp[b*d*Cos[e + f*x]*(Sin[e + f*x]/(2*f)), x]) /; Free 
Q[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0]
 

rule 3232
Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*sin[(e_.) + 
(f_.)*(x_)]), x_Symbol] :> Simp[(-d)*Cos[e + f*x]*((a + b*Sin[e + f*x])^m/( 
f*(m + 1))), x] + Simp[1/(m + 1)   Int[(a + b*Sin[e + f*x])^(m - 1)*Simp[b* 
d*m + a*c*(m + 1) + (a*d*m + b*c*(m + 1))*Sin[e + f*x], x], x], x] /; FreeQ 
[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 - b^2, 0] && GtQ[m, 
 0] && IntegerQ[2*m]
 

rule 3495
Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (C_.)*sin[(e_.) + 
 (f_.)*(x_)]^2), x_Symbol] :> Simp[C/b^2   Int[(a + b*Sin[e + f*x])^(m + 1) 
*Simp[-a + b*Sin[e + f*x], x], x], x] /; FreeQ[{a, b, e, f, A, C, m}, x] && 
 EqQ[A*b^2 + a^2*C, 0]
 
3.6.60.4 Maple [A] (verified)

Time = 3.49 (sec) , antiderivative size = 87, normalized size of antiderivative = 0.67

method result size
derivativedivides \(\frac {a^{4} \left (d x +c \right )-\frac {2 a \,b^{3} \left (2+\cos ^{2}\left (d x +c \right )\right ) \sin \left (d x +c \right )}{3}+2 \sin \left (d x +c \right ) a^{3} b -b^{4} \left (\frac {\left (\cos ^{3}\left (d x +c \right )+\frac {3 \cos \left (d x +c \right )}{2}\right ) \sin \left (d x +c \right )}{4}+\frac {3 d x}{8}+\frac {3 c}{8}\right )}{d}\) \(87\)
default \(\frac {a^{4} \left (d x +c \right )-\frac {2 a \,b^{3} \left (2+\cos ^{2}\left (d x +c \right )\right ) \sin \left (d x +c \right )}{3}+2 \sin \left (d x +c \right ) a^{3} b -b^{4} \left (\frac {\left (\cos ^{3}\left (d x +c \right )+\frac {3 \cos \left (d x +c \right )}{2}\right ) \sin \left (d x +c \right )}{4}+\frac {3 d x}{8}+\frac {3 c}{8}\right )}{d}\) \(87\)
parallelrisch \(\frac {96 a^{4} d x -36 b^{4} d x +192 \sin \left (d x +c \right ) a^{3} b -144 \sin \left (d x +c \right ) a \,b^{3}-3 \sin \left (4 d x +4 c \right ) b^{4}-16 \sin \left (3 d x +3 c \right ) a \,b^{3}-24 \sin \left (2 d x +2 c \right ) b^{4}}{96 d}\) \(88\)
parts \(a^{4} x -\frac {b^{4} \left (\frac {\left (\cos ^{3}\left (d x +c \right )+\frac {3 \cos \left (d x +c \right )}{2}\right ) \sin \left (d x +c \right )}{4}+\frac {3 d x}{8}+\frac {3 c}{8}\right )}{d}+\frac {2 \sin \left (d x +c \right ) a^{3} b}{d}-\frac {2 a \,b^{3} \left (2+\cos ^{2}\left (d x +c \right )\right ) \sin \left (d x +c \right )}{3 d}\) \(88\)
risch \(a^{4} x -\frac {3 b^{4} x}{8}+\frac {2 \sin \left (d x +c \right ) a^{3} b}{d}-\frac {3 \sin \left (d x +c \right ) a \,b^{3}}{2 d}-\frac {b^{4} \sin \left (4 d x +4 c \right )}{32 d}-\frac {a \,b^{3} \sin \left (3 d x +3 c \right )}{6 d}-\frac {b^{4} \sin \left (2 d x +2 c \right )}{4 d}\) \(95\)
norman \(\frac {\left (a^{4}-\frac {3 b^{4}}{8}\right ) x +\left (a^{4}-\frac {3 b^{4}}{8}\right ) x \left (\tan ^{8}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (4 a^{4}-\frac {3 b^{4}}{2}\right ) x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (4 a^{4}-\frac {3 b^{4}}{2}\right ) x \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (6 a^{4}-\frac {9 b^{4}}{4}\right ) x \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\frac {b \left (16 a^{3}-16 a \,b^{2}-5 b^{3}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{4 d}+\frac {b \left (16 a^{3}-16 a \,b^{2}+5 b^{3}\right ) \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{4 d}+\frac {b \left (144 a^{3}-80 a \,b^{2}-9 b^{3}\right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{12 d}+\frac {b \left (144 a^{3}-80 a \,b^{2}+9 b^{3}\right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{12 d}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{4}}\) \(257\)

input
int((a+cos(d*x+c)*b)^2*(-b^2*cos(d*x+c)^2+a^2),x,method=_RETURNVERBOSE)
 
output
1/d*(a^4*(d*x+c)-2/3*a*b^3*(2+cos(d*x+c)^2)*sin(d*x+c)+2*sin(d*x+c)*a^3*b- 
b^4*(1/4*(cos(d*x+c)^3+3/2*cos(d*x+c))*sin(d*x+c)+3/8*d*x+3/8*c))
 
3.6.60.5 Fricas [A] (verification not implemented)

Time = 0.29 (sec) , antiderivative size = 80, normalized size of antiderivative = 0.62 \[ \int (a+b \cos (c+d x))^2 \left (a^2-b^2 \cos ^2(c+d x)\right ) \, dx=\frac {3 \, {\left (8 \, a^{4} - 3 \, b^{4}\right )} d x - {\left (6 \, b^{4} \cos \left (d x + c\right )^{3} + 16 \, a b^{3} \cos \left (d x + c\right )^{2} + 9 \, b^{4} \cos \left (d x + c\right ) - 48 \, a^{3} b + 32 \, a b^{3}\right )} \sin \left (d x + c\right )}{24 \, d} \]

input
integrate((a+b*cos(d*x+c))^2*(a^2-b^2*cos(d*x+c)^2),x, algorithm="fricas")
 
output
1/24*(3*(8*a^4 - 3*b^4)*d*x - (6*b^4*cos(d*x + c)^3 + 16*a*b^3*cos(d*x + c 
)^2 + 9*b^4*cos(d*x + c) - 48*a^3*b + 32*a*b^3)*sin(d*x + c))/d
 
3.6.60.6 Sympy [A] (verification not implemented)

Time = 0.17 (sec) , antiderivative size = 190, normalized size of antiderivative = 1.47 \[ \int (a+b \cos (c+d x))^2 \left (a^2-b^2 \cos ^2(c+d x)\right ) \, dx=\begin {cases} a^{4} x + \frac {2 a^{3} b \sin {\left (c + d x \right )}}{d} - \frac {4 a b^{3} \sin ^{3}{\left (c + d x \right )}}{3 d} - \frac {2 a b^{3} \sin {\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{d} - \frac {3 b^{4} x \sin ^{4}{\left (c + d x \right )}}{8} - \frac {3 b^{4} x \sin ^{2}{\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{4} - \frac {3 b^{4} x \cos ^{4}{\left (c + d x \right )}}{8} - \frac {3 b^{4} \sin ^{3}{\left (c + d x \right )} \cos {\left (c + d x \right )}}{8 d} - \frac {5 b^{4} \sin {\left (c + d x \right )} \cos ^{3}{\left (c + d x \right )}}{8 d} & \text {for}\: d \neq 0 \\x \left (a + b \cos {\left (c \right )}\right )^{2} \left (a^{2} - b^{2} \cos ^{2}{\left (c \right )}\right ) & \text {otherwise} \end {cases} \]

input
integrate((a+b*cos(d*x+c))**2*(a**2-b**2*cos(d*x+c)**2),x)
 
output
Piecewise((a**4*x + 2*a**3*b*sin(c + d*x)/d - 4*a*b**3*sin(c + d*x)**3/(3* 
d) - 2*a*b**3*sin(c + d*x)*cos(c + d*x)**2/d - 3*b**4*x*sin(c + d*x)**4/8 
- 3*b**4*x*sin(c + d*x)**2*cos(c + d*x)**2/4 - 3*b**4*x*cos(c + d*x)**4/8 
- 3*b**4*sin(c + d*x)**3*cos(c + d*x)/(8*d) - 5*b**4*sin(c + d*x)*cos(c + 
d*x)**3/(8*d), Ne(d, 0)), (x*(a + b*cos(c))**2*(a**2 - b**2*cos(c)**2), Tr 
ue))
 
3.6.60.7 Maxima [A] (verification not implemented)

Time = 0.20 (sec) , antiderivative size = 84, normalized size of antiderivative = 0.65 \[ \int (a+b \cos (c+d x))^2 \left (a^2-b^2 \cos ^2(c+d x)\right ) \, dx=\frac {96 \, {\left (d x + c\right )} a^{4} + 64 \, {\left (\sin \left (d x + c\right )^{3} - 3 \, \sin \left (d x + c\right )\right )} a b^{3} - 3 \, {\left (12 \, d x + 12 \, c + \sin \left (4 \, d x + 4 \, c\right ) + 8 \, \sin \left (2 \, d x + 2 \, c\right )\right )} b^{4} + 192 \, a^{3} b \sin \left (d x + c\right )}{96 \, d} \]

input
integrate((a+b*cos(d*x+c))^2*(a^2-b^2*cos(d*x+c)^2),x, algorithm="maxima")
 
output
1/96*(96*(d*x + c)*a^4 + 64*(sin(d*x + c)^3 - 3*sin(d*x + c))*a*b^3 - 3*(1 
2*d*x + 12*c + sin(4*d*x + 4*c) + 8*sin(2*d*x + 2*c))*b^4 + 192*a^3*b*sin( 
d*x + c))/d
 
3.6.60.8 Giac [A] (verification not implemented)

Time = 0.29 (sec) , antiderivative size = 91, normalized size of antiderivative = 0.71 \[ \int (a+b \cos (c+d x))^2 \left (a^2-b^2 \cos ^2(c+d x)\right ) \, dx=-\frac {b^{4} \sin \left (4 \, d x + 4 \, c\right )}{32 \, d} - \frac {a b^{3} \sin \left (3 \, d x + 3 \, c\right )}{6 \, d} - \frac {b^{4} \sin \left (2 \, d x + 2 \, c\right )}{4 \, d} + \frac {1}{8} \, {\left (8 \, a^{4} - 3 \, b^{4}\right )} x + \frac {{\left (4 \, a^{3} b - 3 \, a b^{3}\right )} \sin \left (d x + c\right )}{2 \, d} \]

input
integrate((a+b*cos(d*x+c))^2*(a^2-b^2*cos(d*x+c)^2),x, algorithm="giac")
 
output
-1/32*b^4*sin(4*d*x + 4*c)/d - 1/6*a*b^3*sin(3*d*x + 3*c)/d - 1/4*b^4*sin( 
2*d*x + 2*c)/d + 1/8*(8*a^4 - 3*b^4)*x + 1/2*(4*a^3*b - 3*a*b^3)*sin(d*x + 
 c)/d
 
3.6.60.9 Mupad [B] (verification not implemented)

Time = 1.81 (sec) , antiderivative size = 107, normalized size of antiderivative = 0.83 \[ \int (a+b \cos (c+d x))^2 \left (a^2-b^2 \cos ^2(c+d x)\right ) \, dx=a^4\,x-\frac {3\,b^4\,x}{8}-\frac {b^4\,{\cos \left (c+d\,x\right )}^3\,\sin \left (c+d\,x\right )}{4\,d}-\frac {4\,a\,b^3\,\sin \left (c+d\,x\right )}{3\,d}+\frac {2\,a^3\,b\,\sin \left (c+d\,x\right )}{d}-\frac {3\,b^4\,\cos \left (c+d\,x\right )\,\sin \left (c+d\,x\right )}{8\,d}-\frac {2\,a\,b^3\,{\cos \left (c+d\,x\right )}^2\,\sin \left (c+d\,x\right )}{3\,d} \]

input
int((a^2 - b^2*cos(c + d*x)^2)*(a + b*cos(c + d*x))^2,x)
 
output
a^4*x - (3*b^4*x)/8 - (b^4*cos(c + d*x)^3*sin(c + d*x))/(4*d) - (4*a*b^3*s 
in(c + d*x))/(3*d) + (2*a^3*b*sin(c + d*x))/d - (3*b^4*cos(c + d*x)*sin(c 
+ d*x))/(8*d) - (2*a*b^3*cos(c + d*x)^2*sin(c + d*x))/(3*d)